$(function(){
    ko.bindingHandlers.jqDatepicker = {
        init: function(element, valueAccessor, allBindingsAccessor){
            var options = kjq.utils.getOptions(allBindingsAccessor);
            $(element).datepicker(options);
            ko.utils.registerEventHandler(element, "change", function () {
                var observable = valueAccessor();
                observable($(element).datepicker("getDate"));
                $(element).blur();
            });
            
        }
    };
});

